package com.example.demo.huawei;

import java.util.Arrays;
import java.util.Scanner;

// 小明找位置 排序 二分查找
/*
93,95,97,100,102,123,155
110
*/
//输出 6
public class OD36 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        String[] split = line.split(",");
        int target = sc.nextInt();
        int[] arr = new int[split.length + 1];
        for (int i = 0; i < split.length; i++) {
            arr[i] = Integer.parseInt(split[i]);
        }
        arr[split.length] = target;
        Arrays.sort(arr);
        int left = 0;
        int right = arr.length - 1;
        int res = Integer.MAX_VALUE;
        while (left <= right) {
            int mid = (left + right) >>> 1;
            if (arr[mid] == target) {
                // 相对继续往前找 如果找到了更新结果值
                res = Integer.min(res, mid + 1);
                right = mid - 1;
            } else if (arr[mid] > target) {
                right = mid - 1;
            } else {
                left = mid + 1;
            }
        }
        System.out.println(res);
    }
}
